//
//  SetViewController.m
//  JiFengDaRen
//
//  Created by 陈如意 on 2018/6/22.
//  Copyright © 2018年 陈永发. All rights reserved.
//

#import "SetViewController.h"
#import "SHUserCenterCell.h"
#import "ForgetPswViewController.h"
#import "SHAboutAppViewController.h"
@interface SetViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView * setTableView;

@end

@implementation SetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"设置";
    
    [self setTableView];    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SHUserCenterCell * cell = [SHUserCenterCell tableViewCellWithTableView:tableView];
    [cell getTitleName:@[@"修改登录密码",@"关于我们"][indexPath.row]];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return __I6Height(50);
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.01;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    if (indexPath.row == 0) {
        ForgetPswViewController * pswVC = [[ForgetPswViewController alloc] init];
        [self.navigationController pushViewController:pswVC animated:YES];
    }else{
        SHAboutAppViewController * aboutVC = [[SHAboutAppViewController alloc] init];
        [self.navigationController pushViewController:aboutVC animated:YES];
    }
}

- (UITableView *)setTableView{
    if (!_setTableView) {
        _setTableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];
        _setTableView.delegate = self;
        _setTableView.dataSource = self;
        _setTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [self.view addSubview:_setTableView];
    }
    return _setTableView;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


@end
